﻿//////////////////////////////////////////////////////////////////////////////
//
//  Copyright © 1998-2024 Glodon Company Limited.  All rights reserved.
//
//  Use of this software is subject to the terms of the Glodon license
//  agreement provided at the time of installation or download, or which
//  otherwise accompanies this software in either electronic or hard copy form.  
//
//////////////////////////////////////////////////////////////////////////////


#pragma once
#include "GnufConfiguration.h"
#include "GnufHotkeyManager.h"
#ifndef _GNUF_WIP_TEST_HOTKEY_MANAGER_2_LOGIC_
class QXmlStreamAttributes;

namespace gnuf {
    class HotkeyGroup;
    class GNUF_BASE_EXPORT HotkeyConfiguration : public Configuration
    {
    public:
        HotkeyConfiguration();
        HotkeyConfiguration(const std::list<HotkeyGroup*> &hotKeyGroups);
        ~HotkeyConfiguration();
        bool read();
        bool write();
        bool loadPulgInXml(const std::wstring& xmlPath);
        // Inherits from Configuration...
        virtual void parseElement(int, const QXmlStreamReader &) override final;
        virtual void dumpElements(QXmlStreamWriter &) const override final;
    private:
        bool AddHotkey(const QXmlStreamAttributes& attributes);
        bool AddHotkeyGroup(const QXmlStreamAttributes& attributes);

        void dumpGroup(QXmlStreamWriter &, const HotkeyGroup *) const;
        void dumpHotkey(QXmlStreamWriter &, const SingleHotkeySetting * keysetting) const;

        std::list<HotkeyGroup*> m_hotKeyGroups;
    };
}
#endif // _GNUF_WIP_TEST_HOTKEY_MANAGER_2_LOGIC_
